﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using SharpArch.Domain.DomainModel;

namespace DevelopmentKit.Cms.Domain
{
    /// <summary>
    /// 内容类型
    /// </summary>
    public class Definition:Entity
    {
        /// <summary>
        /// 名称
        /// </summary>
        [Display(Name = "名称")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(128, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Name { get; set; }
        /// <summary>
        /// 内容模版
        /// </summary>
        [Display(Name = "内容模版")]
        public virtual ViewTemplate Template { get; set; } 
        /// <summary>
        /// 企业Id
        /// </summary>
        [Display(Name = "企业Id")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual int EnterpriseId { get; set; }

        /// <summary>
        /// 是否节点
        /// </summary>
        [Display(Name = "是否节点")]
        [Required(ErrorMessage = "{0}不能为空")] 
        public virtual bool IsNode { get; set; }


        /// <summary>
        /// 是否根节点
        /// </summary>
        [Display(Name = "是否根节点")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual bool IsRoot { get; set; }

        /// <summary>
        /// 可添加的子级类型
        /// </summary>
        [Display(Name = "可添加的子级类型")]
        public virtual IList<Definition> AllowChildrenDefinitions { get; set; }
        /// <summary>
        /// 内容属性
        /// </summary>
        [Display(Name = "属性")]
        public virtual IList<ContentProperty> Propertys { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(500, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Remark { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual DateTime Created { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        [Display(Name = "修改时间")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual DateTime Modified { get; set; }
    }
}